package config

import "github.com/spf13/viper"

type ViperData struct {
	Mysql struct {
		Username string
		Password string
		Host     string
		Port     int
		Database string
	}

	Redis struct {
		Addr     string
		Password string
		DB       int
	}
}

//type Nacons struct {
//	NamespaceId string
//	IpAddr      string
//	Port        int
//	DataId      string
//	Group       string
//}

var (
	Conf ViperData
	//NaconsConf Nacons
)

func GetViperData() {
	viper.SetConfigFile("D:\\GOWORK\\zk2\\short_v\\srv-server\\dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		panic("配置文件读取失败")
	}
	err = viper.Unmarshal(&Conf)
	if err != nil {
		panic("配置文件解析失败1")
	}
	//err = viper.Unmarshal(&NaconsConf)
	//if err != nil {
	//	panic("配置文件解析失败2")
	//}
}
